package com.coscon.service.patternCommon.impl.ppt;

import com.coscon.model.IrcaCmd;
import com.coscon.service.patternCommon.ICommand;
import lombok.extern.slf4j.Slf4j;

import javax.websocket.Session;
import java.awt.*;
import java.awt.event.KeyEvent;

/**
 * 上一个
 */
@Slf4j
public class PreviousCmdImpl implements ICommand {
    private Robot rb;

    public PreviousCmdImpl(Robot rb){
        this.rb = rb;
    }



    @Override
    public Boolean executeByMac(IrcaCmd cmd, Session session) {
        rb.keyPress(KeyEvent.VK_UP);
        rb.delay(10);
        rb.keyRelease(KeyEvent.VK_UP);
        return true;
    }

    @Override
    public Boolean executeByWin(IrcaCmd cmd, Session session) {
        rb.keyPress(KeyEvent.VK_UP);
        rb.delay(10);
        rb.keyRelease(KeyEvent.VK_UP);
        return true;
    }

    @Override
    public Boolean executeByLinux(IrcaCmd cmd, Session session) {
        return true;
    }

}
